package com.rj.bd.er;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @desc   第二题
 * @author lipf
 * @time   2021-10-02
 */
public class Test {

	public static void main(String[] args) {

		List<String> list=new ArrayList<String>();
		
		list.add("atsd");
		list.add("asdgi");
		list.add("asjkld");
		list.add("ad");
		list.add("asevfrsd");
		System.out.println("字符串排序前为：");
		for (String every : list) {
			System.out.println(every);
		}
        List<String> a = list.stream().sorted((o1,o2)->o1.length()-o2.length()).collect(Collectors.toList());
        System.out.println("字符串排序后为：");
        a.forEach(b->System.out.println(b));
		
		
		
		
	}

}
